<?php

namespace App\Http\Controllers\Api\V1\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class BrokerageResource extends JsonResource
{
    public function toArray($request)
    {
    	$resource = $this->resource;
        $data = [
        	
        	'id' => $resource->id,
        	'money' => $resource->is_taken ? $resource->money : 0,
        	'remark' => $resource->remark,
        	'reason' => $resource->reason,
        	'created_at' => (string)$resource->created_at ?? '',
            'is_taken' => (bool)$resource->is_taken
	        
        ];
        
        return $data;
    }
}
